using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Wrath.RuleForge.Common
{
    public partial class ProgressDialog : Form
    {
        public string Title { get { return Text; } set { Text = value; } }
        public string CurrentOperation { get { return labelOperation.Text; } set { labelOperation.Text = value; Application.DoEvents(); } }
        public int Progress { get { return progressBar.Value; } set { progressBar.Value = value; Application.DoEvents(); } }

        public event EventHandler CancelOperation;

        public ProgressDialog()
        {
            InitializeComponent();
        }

        public void Increment(int amount)
        {
            progressBar.Increment(amount);
            Application.DoEvents();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            if (CancelOperation != null)
            {
                CancelOperation(this, new EventArgs());
            }

            Close();
        }
    }
}